import { QueryOptionsDto } from '@/types/common/dto/query.options.dto';
import { QueryListVo } from '@/types/common/vo/query.list.vo';
import { UserEntity } from '../entities/user.entity';
import { UserRoleEntity } from '../entities/user.role.entity';
import { TeamEntity } from '../../editor/entities/team.entity';

/**
 * 【API】用户登录
 */
export class IApiUserRegisterDto {
  /**
   * 手机号
   */
  phone?: string;
  /**
   * 密码
   */
  password?: string;
  /**
   * 短信验证码
   */
  sms_code?: string;
}

export class IApiUserRegisterRes {}

/**
 * 【API】用户登录
 */
export class IApiUserLoginDto {
  /**
   * 手机号
   */
  phone?: string;
  /**
   * 密码
   */
  password?: string;
  /**
   * 验证码
   */
  sms_code?: string;
}

export class IApiUserLoginRes {
  token: string;
}

/**
 * 【API】微信手机号登录
 */
export class IApiUserLoginByWechatDto {
  code: string;
  encryptedData: string;
  iv: string;
}

export class IApiUserLoginByWechatRes {
  token: string;
}

/**
 * 【API】获取微信用户资料
 */
export class IApiUserUpdateProfileByWechatDto {
  code: string;
  encryptedData: string;
  iv: string;
  /**
   * 昵称（getUserInfo结果中的userInfo）
   */
  nickName: string;
  avatarUrl: string;
  gender: number;
  country: string;
  province: string;
  city: string;
}

export class IApiUserGetUserListReqDto extends QueryOptionsDto {
  filter: {
    /**
     * 关键词搜索
     */
    keywords?: string;
  };
}

export class IApiUserGetUserListVo extends UserEntity {}

export class IApiUserGetUserListResDto extends QueryListVo {
  data: IApiUserGetUserListVo[];
}

/**
 * 获取用户角色
 */
export class IApiUserGetUserRoleReqDto extends QueryOptionsDto {
  filter: {
    /**
     * 关键词搜索
     */
    keywords?: string;
  };
}

export class IApiUserGetUserRoleVo extends UserRoleEntity {}

export type IApiUserGetUserRoleResDto = IApiUserGetUserRoleVo[];


export class IApiUserPutTeamReqDto extends TeamEntity {
  /**
   * 团队名称
   */
  name: string;
}

export class IApiUserGetTeamReqDto {
  teamId?: number;
}

export type IApiUserGetTeamResDto = TeamEntity[];

export class IApiUserPutTeamResDto extends TeamEntity {};

export class IApiUserGetLoginQrcodeReqDto {
  sessionId?: string;
}

export class IApiUserPutTeamMemberReqDto {
  /**
   * 手机号
   */
  phone: string;
  /**
   * 团队ID
   */
  teamId: number;
}

export class IApiUserPutTeamMemberResDto extends UserRoleEntity {};


export class IApiUserGetTeamMemberReqDto extends QueryOptionsDto {
  filter: {
    teamId: number;

    /**
     * 关键词搜索
     */
    keywords?: string;
  };
}

export class IApiUserGetTeamMemberVo extends UserRoleEntity {}

export class IApiUserGetTeamMemberResDto extends QueryListVo {
  data: IApiUserGetUserListVo[];
}